Package-level declarations

Types

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
interface NotEmptyCollection<out E> : Collection<E>

Represents collections containing at least one element.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
class NotEmptyList<out E>(val head: E, tail: E) : AbstractList<E> , NotEmptyCollection<E>

Represents lists containing at least one element.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
class NotEmptyMutableList<E>(var head: E, tail: E) : AbstractMutableList<E> , NotEmptyCollection<E>

Represents mutable lists containing at least one element.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
class NotEmptyMutableSet<E>(var head: E, tail: E) : AbstractMutableSet<E> , NotEmptyCollection<E>

Represents mutable sets containing at least one element.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
class NotEmptySet<out E>(val head: E, tail: E) : AbstractSet<E> , NotEmptyCollection<E>

Represents sets containing at least one element.

Functions

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> NotEmptyCollection<E>.getOrElse(index: Int, defaultValue: (Int) -> @UnsafeVariance E): E
@SinceKotoolsTypes(version = "1.3")
inline fun <E> NotEmptyCollection<E>.getOrElse(index: PositiveInt, defaultValue: (PositiveInt) -> @UnsafeVariance E): E
@SinceKotoolsTypes(version = "1.3")
inline fun <E> NotEmptyCollection<E>.getOrElse(index: StrictlyPositiveInt, defaultValue: (StrictlyPositiveInt) -> @UnsafeVariance E): E

Returns the element at the specified index in this collection, or returns the result of calling the defaultValue function if the index is out of bounds.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Array<E>.toNotEmptyList(): NotEmptyList<E>

Returns a not empty list containing all the elements of this array, or throws an IllegalArgumentException if this array is empty.

@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptyList(): NotEmptyList<E>

Returns a not empty list containing all the elements of this collection, or throws an IllegalArgumentException if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
infix inline fun <E> Array<E>.toNotEmptyListOrElse(defaultValue: (Array<E>) -> NotEmptyList<E>): NotEmptyList<E>

Returns a not empty list containing all the elements of this array, or returns the result of calling the defaultValue function if this array is empty.

@SinceKotoolsTypes(version = "1.3")
infix inline fun <E> Collection<E>.toNotEmptyListOrElse(defaultValue: (Collection<E>) -> NotEmptyList<E>): NotEmptyList<E>

Returns a not empty list containing all the elements of this collection, or returns the result of calling the defaultValue function if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Array<E>.toNotEmptyListOrNull(): NotEmptyList<E>?

Returns a not empty list containing all the elements of this array, or returns null if this array is empty.

@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptyListOrNull(): NotEmptyList<E>?

Returns a not empty list containing all the elements of this collection, or returns null if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Array<E>.toNotEmptyMutableList(): NotEmptyMutableList<E>

Returns a not empty mutable list containing all the elements of this array, or throws an IllegalArgumentException if this array is empty.

@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptyMutableList(): NotEmptyMutableList<E>

Returns a not empty mutable list containing all the elements of this collection, or throws an IllegalArgumentException if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
infix inline fun <E> Array<E>.toNotEmptyMutableListOrElse(defaultValue: (Array<E>) -> NotEmptyMutableList<E>): NotEmptyMutableList<E>

Returns a not empty mutable list containing all the elements of this array, or returns the result of calling the defaultValue function if this array is empty.

@SinceKotoolsTypes(version = "1.3")
infix inline fun <E> Collection<E>.toNotEmptyMutableListOrElse(defaultValue: (Collection<E>) -> NotEmptyMutableList<E>): NotEmptyMutableList<E>

Returns a not empty mutable list containing all the elements of this collection, or returns the result of calling the defaultValue function if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Array<E>.toNotEmptyMutableListOrNull(): NotEmptyMutableList<E>?

Returns a not empty mutable list containing all the elements of this array, or returns null if this array is empty.

@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptyMutableListOrNull(): NotEmptyMutableList<E>?

Returns a not empty mutable list containing all the elements of this collection, or returns null if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Array<E>.toNotEmptyMutableSet(): NotEmptyMutableSet<E>

Returns a not empty mutable set containing all the elements of this array, or throws an IllegalArgumentException if this array is empty.

@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptyMutableSet(): NotEmptyMutableSet<E>

Returns a not empty mutable set containing all the elements of this collection, or throws an IllegalArgumentException if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
infix inline fun <E> Array<E>.toNotEmptyMutableSetOrElse(defaultValue: (Array<E>) -> NotEmptyMutableSet<E>): NotEmptyMutableSet<E>

Returns a not empty mutable set containing all the elements of this array, or returns the result of calling the defaultValue function if this array is empty.

@SinceKotoolsTypes(version = "1.3")
infix inline fun <E> Collection<E>.toNotEmptyMutableSetOrElse(defaultValue: (Collection<E>) -> NotEmptyMutableSet<E>): NotEmptyMutableSet<E>

Returns a not empty mutable set containing all the elements of this collection, or returns the result of calling the defaultValue function if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Array<E>.toNotEmptyMutableSetOrNull(): NotEmptyMutableSet<E>?

Returns a not empty mutable set containing all the elements of this array, or returns null if this array is empty.

@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptyMutableSetOrNull(): NotEmptyMutableSet<E>?

Returns a not empty mutable set containing all the elements of this collection, or returns null if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Array<E>.toNotEmptySet(): NotEmptySet<E>

Returns a not empty set containing all the elements of this array, or throws an IllegalArgumentException if this array is empty.

@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptySet(): NotEmptySet<E>

Returns a not empty set containing all the elements of this collection, or throws an IllegalArgumentException if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
infix inline fun <E> Array<E>.toNotEmptySetOrElse(defaultValue: (Array<E>) -> NotEmptySet<E>): NotEmptySet<E>

Returns a not empty set containing all the elements of this array, or returns the result of calling the defaultValue function if this array is empty.

@SinceKotoolsTypes(version = "1.3")
infix inline fun <E> Collection<E>.toNotEmptySetOrElse(defaultValue: (Collection<E>) -> NotEmptySet<E>): NotEmptySet<E>

Returns a not empty set containing all the elements of this collection, or returns the result of calling the defaultValue function if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Array<E>.toNotEmptySetOrNull(): NotEmptySet<E>?

Returns a not empty set containing all the elements of this array, or returns null if this array is empty.

@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptySetOrNull(): NotEmptySet<E>?

Returns a not empty set containing all the elements of this collection, or returns null if this collection is empty.